#ifndef VENDOR_ECARX_IPLM_V1_0_IPLM_VEHICLE_H
#define VENDOR_ECARX_IPLM_V1_0_IPLM_VEHICLE_H

#include <android/hardware/automotive/vehicle/2.0/IVehicleCallback.h>
#include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
#include <android/hardware/automotive/vehicle/2.0/types.h>
#include <vendor/ecarx/xma/automotive/vehicle/2.0/types.h>

#include <cstdint>
#include <sys/cdefs.h>
#include <sys/types.h>
#include "Def.h"

using ::android::sp;
using ::android::hardware::automotive::vehicle::V2_0::VehicleProperty;
using ::android::hardware::automotive::vehicle::V2_0::VehiclePropValue;
using vendor::ecarx::xma::automotive::vehicle::V2_0::DirectTransmitProperty;
//using vendor::ecarx::xma::automotive::vehicle::V2_0::VendorSignalPropertyRX;

typedef android::hardware::automotive::vehicle::V2_0::StatusCode Automotive_StatusCode;

namespace vendor {
namespace ecarx {
namespace xma {
namespace iplm {
namespace V1_0 {
namespace implementation {

using namespace ::android::hardware::automotive::vehicle::V2_0;

// According to SWRS << 86715 Resource Grouping >>
// CarConfig500 value != 0x02 means DMM is NOT available
constexpr int32_t DMM_ = 0x02;

// CarConfig483 value != 0x02 means DVR is NOT available
constexpr int32_t DVR_ = 0x02;

// CarConfig142(PARKING ASSISTANCE) != 0x83 means PAS is NOT available
constexpr int32_t PAS_ = 0x83;

// CarConfig100 value != 0x80 means that ASDM is NOT available
constexpr int32_t ASDM_ = 0x80;

// CarConfig157 value != 0x02 means that DIM is NOT available
constexpr int32_t DIM_ = 0x02;

class VehicleHelper {
    public:
        VehicleHelper();
        ~VehicleHelper();

        void init();
        bool isDMMAvailable();
        bool isDVRAvailable();
        bool isPASAvailable();
        bool isASDMAvailable();
        bool isDIMAvailable();

        int32_t RG_1_checkin();
        int32_t RG_2_checkin();
        int32_t RG_3_checkin();
        int32_t RG_4_checkin();
        int32_t RG_5_checkin();
        int32_t RG_6_checkin();
        int32_t RG_7_checkin();

        bool isUDPLinkLostDTCSet(const ECU_Node node);

        int32_t getCarConfig(const int32_t config);
        void setPowerState(IPLM_Power_State status);
        void setUDPLinkLostDTC(const ECU_Node node, IPLM_DTC_VALUE value);
        void setDID();
        void wakeupVFC();

    private:
        sp<IVehicle> mVehicle = nullptr;

        // CarConfig500 value != 0x02 means DMM is NOT available
        const int32_t DMM_CarConfig = static_cast<int32_t>(0/*VendorSignalPropertyRX::carconfig500*/);

        // CarConfig483 value != 0x02 means DVR is NOT available
        const int32_t DVR_CarConfig = static_cast<int32_t>(0/*VendorSignalPropertyRX::carconfig483*/);

        // CarConfig142 value != 0x83 means PAS is NOT available
        const int32_t PAS_CarConfig = static_cast<int32_t>(0/*VendorSignalPropertyRX::carconfig142*/);

        // CarConfig100 value != 0x80 means that ASDM is NOT available
        const int32_t ASDM_CarConfig = static_cast<int32_t>(0/*VendorSignalPropertyRX::carconfig100*/);

        // CarConfig157 value != 0x02 means that DIM is NOT available
        const int32_t DIM_CarConfig = static_cast<int32_t>(0/*VendorSignalPropertyRX::carconfig157*/);

        bool setValue(VehiclePropValue setProp);
        bool getValue(VehiclePropValue & requestedProp);

        bool mDMMFound;
        bool mDVRFound;
        bool mPASFound;
        bool mASDMFound;
        bool mDIMFound;

        bool mTCAM_DTC;
        bool mVGM_DTC;
        bool mASDM_DTC;
};


} // namespace implementation
} // namespace V1_0
} // namespace iplm
} // namespace xma
} // namespace ecarx
} // namespace vendor

#endif /* VENDOR_ECARX_IPLM_V1_0_IPLM_VEHICLE_H */